package com.dfbz.controller.meet;

import com.dfbz.controller.BaseServlet;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;

@WebServlet("/meet/*")
public class MeetServlet extends BaseServlet {

    public void list(HttpServletRequest request, HttpServletResponse response) {
        try {
            String currentPage = request.getParameter("currentPage");
            String search = request.getParameter("search");
            String deptId = request.getParameter("dep");
            int page = 1;
            if (null != currentPage) {
                page = Integer.parseInt(currentPage);
            }
            int dep = 0;
            if (null != deptId) {
                dep = Integer.parseInt(deptId);
            }
            if (null != search) {
                String encode = URLEncoder.encode(search, "UTF-8");
                response.sendRedirect(request.getContextPath() + "/view/meetList?deptId=" + dep + "&page=" + page + "&search=" + encode);
            } else {
                response.sendRedirect(request.getContextPath() + "/view/meetList?deptId=" + dep + "&page=" + page);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
